using UnityEngine;

public interface ICandyTypes {
	GameObject GetCandy();
}
public class SimpleCandy:ICandyTypes{
	private string color;
	public SimpleCandy(string color){
		this.color=color;
	}
	public GameObject GetCandy(){
		return  MonoBehaviour.Instantiate(Resources.Load("Prefab/simple/"+color)) as GameObject;	
	}
}
public class HorizontalCandy:ICandyTypes{
	private string color;
	public HorizontalCandy(string color){
		this.color=color;
	}
	public GameObject GetCandy(){
		return  MonoBehaviour.Instantiate(Resources.Load("Prefab/horizontal/"+color)) as GameObject;	
	}
}
public class VerticalCandy:ICandyTypes{
	private string color;
	public VerticalCandy(string color){
		this.color=color;
	}
	public GameObject GetCandy(){
		return  MonoBehaviour.Instantiate(Resources.Load("Prefab/vertical/"+color)) as GameObject;	
	}
}
public class SpecialCandy:ICandyTypes{
	private string color;
	public SpecialCandy(string color){
		this.color=color;
	}
	public GameObject GetCandy(){
		return  MonoBehaviour.Instantiate(Resources.Load("Prefab/special/"+color)) as GameObject;	
	}
}
	public class StarCandy:ICandyTypes{
		public StarCandy(){
		}
		public GameObject GetCandy(){
			return  MonoBehaviour.Instantiate(Resources.Load("Prefab/star/star")) as GameObject;	
		}
}
public class Candy{
	ICandyTypes cm;
	public ICandyTypes getCandy(string color,string type){
		switch(type){
		case "simple":	 cm=new SimpleCandy(color);break;
		case "vertical": cm=new VerticalCandy(color);break;
		case "horizontal":cm=new HorizontalCandy(color);break;
		case "special":cm=new SpecialCandy(color);break;
		case"star":cm=new StarCandy();break;
		default: cm=null;break;
		}
		return cm;
	}
}